import { url } from "@/api/url"

import request from '@/utils/request'

export function listJob(query) {
    return request({
        url: url + '/jobinfo/pageList',
        method: 'get',
        params: query
    })
}

export function deleteJob(id) {
    return request({
        url: url + '/jobinfo/remove',
        method: 'get',
        params: { "id": id }
    })
}

export function updateJob(param) {
    return request({
        url: url + '/jobinfo/update',
        method: 'post',
        data: param
    })
}

export function addJob(param) {
    return request({
        url: url + '/jobinfo/add',
        method: 'post',
        data: param
    })
}

export function stopJob(id) {
    return request({
        url: url + '/jobinfo/stop',
        method: 'get',
        params: { "id": id }
    })
}

export function startJob(id) {
    return request({
        url: url + '/jobinfo/start',
        method: 'get',
        params: { "id": id }
    })
}

export function triggerJob(id) {
    return request({
        url: url + '/jobinfo/trigger',
        method: 'get',
        params: { "id": id }
    })
}


export function nextTriggerTime(cron) {
    return request({
        url: url + '/jobinfo/nextTriggerTime',
        method: 'get',
        params: { "cron": cron }
    })
}